<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="./layui/css/layui.css">
</head>
<body>
  <button class="layui-btn layui-btn-warm">按钮</button>
  <div id="rate"></div>
  <script src="./layui/layui.js"></script>
  <script>
    layui.use(['layer', 'jquery', 'rate'], function(){
      // 全部代码写在回调中 引入模块 定义在 layui.layer
      var layer = layui.layer;
      var $ = layui.jquery;
      var rate = layui.rate;
      layer.msg('你好世界')
      
      //渲染
      var ins1 = rate.render({
        elem: '#rate'  //绑定元素
      });
    })
  </script>
</body>
</html>